<?php

/**
 * Bug filter form base class.
 *
 * @package    KC-INDICATEURS
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseBugFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'application_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Application'), 'add_empty' => true)),
      'numero_mantis'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'severite'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'resolution'         => new sfWidgetFormFilterInput(),
      'statut'             => new sfWidgetFormFilterInput(),
      'categorie'          => new sfWidgetFormFilterInput(),
      'resume'             => new sfWidgetFormFilterInput(),
      'priorite'           => new sfWidgetFormFilterInput(),
      'regression'         => new sfWidgetFormFilterInput(),
      'non_corrige'        => new sfWidgetFormFilterInput(),
      'portee'             => new sfWidgetFormFilterInput(),
      'version_resolution' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'application_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Application'), 'column' => 'id')),
      'numero_mantis'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'severite'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'resolution'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'statut'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'categorie'          => new sfValidatorPass(array('required' => false)),
      'resume'             => new sfValidatorPass(array('required' => false)),
      'priorite'           => new sfValidatorPass(array('required' => false)),
      'regression'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'non_corrige'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'portee'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'version_resolution' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bug_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Bug';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'application_id'     => 'ForeignKey',
      'numero_mantis'      => 'Number',
      'severite'           => 'Number',
      'resolution'         => 'Number',
      'statut'             => 'Number',
      'categorie'          => 'Text',
      'resume'             => 'Text',
      'priorite'           => 'Text',
      'regression'         => 'Number',
      'non_corrige'        => 'Number',
      'portee'             => 'Number',
      'version_resolution' => 'Text',
    );
  }
}
